import request from '@/utils/request'
import { download } from '@/utils/request'
// 查询采集记录图片列表
export function listRecordImg(query) {
  return request({
    url: '/peach/recordImg/list',
    method: 'get',
    params: query
  })
}

// 查询采集记录图片详细
export function getRecordImg(id) {
  return request({
    url: '/peach/recordImg/' + id,
    method: 'get'
  })
}

export function getRecordImgByrecordId(recordId) {
  return request({
    url: '/peach/recordImg/record/' + recordId,
    method: 'get'
  })
}

// 新增采集记录图片
export function addRecordImg(data) {
  return request({
    url: '/peach/recordImg',
    method: 'post',
    data: data
  })
}

// 修改采集记录图片
export function updateRecordImg(data) {
  return request({
    url: '/peach/recordImg',
    method: 'put',
    data: data
  })
}

// 删除采集记录图片
export function delRecordImg(id) {
  return request({
    url: '/peach/recordImg/' + id,
    method: 'delete'
  })
}

// 下载单个记录图片压缩包
export function downloadRecordImgZip(recordId, taskName) {
  return download(
    `/peach/recordImg/downloadZip/${recordId}`,
    {},
    `${taskName}-${recordId}.zip`,
    { method: 'get' }
  );
}

// 批量下载多个记录图片到一个压缩包
export function downloadRecordImgZipBatch(recordIds, taskName) {
  return download(
    `/peach/recordImg/downloadZipBatch`,
    { recordIds: recordIds.join(',') },
    `${taskName}.zip`,
    { method: 'post' }
  );
}